Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Make main branch buildable #664

Merged
merged 36 commits into from
Nov 10, 2022
Merged

Conversation

jbelkins
Copy link
Contributor

@jbelkins jbelkins commented Nov 2, 2022

Issue #

Fixes #505
Fixes #620

Description of changes

Summary

The "release" Package.swift may now be merged back to the main branch following a release, because the special logic in the current Package.swift that is used to adapt the manifest for development and CI use is now provided by the manifest generator script.

Details

The package manifest generation script (scripts/generatePackageSwift.swift) has been improved to allow for generation of a manifest that is free of hard-coded paths and special logic, and that may depend upon smithy-swift or aws-crt-swift referred to by published version, branch or local file path.

The contents of Package.swift are now determined entirely by these inputs:

  • The generation script scripts/generatePackageSwift.swift
  • The contents of release/ determine which AWS clients are published.
  • The settings in versionDependencies.plist determine the version, branch, or path where dependencies are located.
  • The env var AWS_SDK_RELEASE_IN_PROGRESS (when set) generates the manifest for a release (dependencies lock to published versions only.)
  • Env vars AWS_SDK_SWIFT_CI_DIR, AWS_CRT_SWIFT_CI_DIR, and SMITHY_SWIFT_CI_DIR (when set) override versionDependencies.plist and set local paths to dependencies. (This is for compatibility with the AWS CRT builder script used on our CI tasks.)

No other factors affect the manifest contents, and the manifest may be regenerated any time one of these factors changes. The Package.swift file should no longer be edited by hand, since edits may be overwritten by the script at any time.

(Note that the codegen/Package.swift manifest used for protocol tests is unchanged, and protocol tests still require that the project be installed at ~/Projects/Amplify/SwiftSDK to run on local.)

When developing on the desktop, developers may use the "package edit mode" features of Xcode or Swift Package Manager to develop against local copies of dependencies rather than edit the Package.swift file.

This will allow the release manifest to be merged back into main on each release, eliminating the current Package.swift custom logic which presupposes the local file system location of the SDK and its dependencies. Once a release is merged back in, a SDK consumer will be able to use the SDK from main without additional steps to set it up. (As noted above, this will resolve #505 & #620.)

This PR has been verified to build successfully when built by another project as a CRT builder script downstream dependency (see smithy-lang/smithy-swift#456 which builds this branch as a downstream.)

This PR has also been verified to build a release successfully ( see #667).

Specific changes:

  • scripts/generatePackageSwift.swift is improved and derived from chore: Simplify CI, allow merging of releases to main #650 with support for:
    • Published versions, branch names or local file paths specified in versionDependencies.plist
    • Local file paths in env vars AWS_SDK_SWIFT_CI_DIR, AWS_CRT_SWIFT_CI_DIR, and SMITHY_SWIFT_CI_DIR
    • Ignores branch name and local file path settings when building with env var AWS_SDK_RELEASE_IN_PROGRESS set
  • Adds a pre-build step to the CRT builder, which dynamically generates Package.swift with file paths pointing to locally installed dependencies when running on CI
  • During release, specify that the package manifest should be generated for release (i.e. with exact versions specified) by setting AWS_SDK_RELEASE_IN_PROGRESS

New/existing dependencies impact assessment, if applicable

No new dependencies were added to this change.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jbelkins jbelkins changed the title chore: Use dynamic manifest with CRT builder chore: Improved Package.swift generation Nov 2, 2022
@jbelkins jbelkins changed the title chore: Improved Package.swift generation chore: Improved Package.swift management, make main buildable Nov 2, 2022
@jbelkins jbelkins changed the title chore: Improved Package.swift management, make main buildable chore: Package.swift generation, make main branch buildable Nov 2, 2022
@jbelkins jbelkins marked this pull request as ready for review November 3, 2022 20:56
@jbelkins jbelkins changed the title chore: Package.swift generation, make main branch buildable chore: Make main branch buildable Nov 3, 2022
Package.swift Outdated Show resolved Hide resolved
@jbelkins jbelkins requested a review from ganeshnj November 9, 2022 16:31
versionDependencies.plist Show resolved Hide resolved
scripts/generatePackageSwift.swift Outdated Show resolved Hide resolved
@jbelkins jbelkins merged commit 3356c91 into main Nov 10, 2022
@jbelkins jbelkins deleted the jbe/crt_builder_with_dynamic_manifest branch November 10, 2022 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unpublished package does not work without extra setup Error parsing the Package.swift file
3 participants